[broadway] Correctly handle ungrabs in the browser side
authorAlexander Larsson <alexl@redhat.com>
Fri, 15 Apr 2011 14:13:01 +0000 (16:13 +0200)
committerAlexander Larsson <alexl@redhat.com>
Fri, 15 Apr 2011 18:34:31 +0000 (20:34 +0200)
Always call doUngrab to get the right event, and always do this
if the grabbed window is hidden or destroyed.

gdk/broadway/broadway.js

index e8e2ea444e9a028c4d9ce59b266c69e26528fb0f..d6fb43d3667a361889e1531685d85d586eff7624 100644 (file)
@@ -560,6 +560,9 @@ function cmdShowSurface(id)
 
 function cmdHideSurface(id)
 {
+    if (grab.window == id)
+       doUngrab();
+
     var surface = surfaces[id];
 
     if (!surface.visible)
@@ -627,6 +630,9 @@ function moveToTop(surface) {
 
 function cmdDeleteSurface(id)
 {
+    if (grab.window == id)
+       doUngrab();
+
     var surface = surfaces[id];
     var i = stackingOrder.indexOf(surface);
     if (i >= 0)
@@ -714,8 +720,8 @@ function cmdGrabPointer(id, ownerEvents)
 function cmdUngrabPointer()
 {
     sendInput ("u", []);
-
-    grab.window = null;
+    if (grab.window)
+       doUngrab();
 }
 
 function handleCommands(cmdObj)
@@ -1100,7 +1106,7 @@ function onMouseUp (ev) {
     sendInput ("B", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, button]);
 
     if (grab.window != null && grab.implicit)
-       doUngrab(ev.timeStamp);
+       doUngrab();
 }
 
 /* Some of the keyboard handling code is from noVNC and